const exp = require('constants');
const express = require('express');
const router = express.Router();
const {back} = require('../middleWare/mysqlController');



// 新建房间
router.post('/back/addRoom', back.addRoom, (req, res)=>{
    res.send({
        code:res.code,
        message:res.message,
        data:res.data,
    })
})

// 获取房间列表数据
router.get('/back/getRoomListData', back.getRoomListData, (req, res)=>{
    res.send({
        code:res.code,
        message:res.message,
        data:res.data,
    })
})

// 修改房间信息
router.put('/back/modifyRoomConfig', back.modifyRoomConfig, (req, res)=>{
    res.send({
        code:res.code,
        message:res.message,
        data:res.data,
    })
})

// 删除房间
router.delete('/back/deleteRoom', back.deleteRoom, (req, res)=>{
    res.send({
        code:res.code,
        message:res.message,
        data:res.data,
    })
})

// 新建房间类型
router.post('/back/addRoomType', back.addRoomType, (req, res)=>{
    res.send({
        code:res.code,
        message:res.message,
        data:res.data,
    })
})

// 获取房间类型列表
router.get('/back/getRoomTypeListData', back.getRoomType, (req, res)=>{
    res.send({
        code:res.code,
        message:res.message,
        data:res.data,
    })
})

// 修改房间类型配置
router.put('/back/modifyRoomTypeConfig', back.modifyRoomTypeConfig, (req, res)=>{
    res.send({
        code:res.code,
        message:res.message,
        data:res.data,
    })
})

// 删除房间类型
router.delete('/back/deleteRoomType', back.deleteRoomType, (req, res)=>{
    res.send({
        code:res.code,
        message:res.message,
        data:res.data,
    })
})

// 获取用户列表['用户名'、'用户ID']
router.get('/back/getUserList', back.getUserList, (req, res)=>{
    res.send({
        code:res.code,
        message:res.message,
        data:res.data,
    })
})

// 根据用户id列表，返回用户具体信息列表
router.post('/back/getUserInfoList', back.getUserInfoList, (req, res)=>{
    res.send({
        code:res.code,
        message:res.message,
        data:res.data,
    })
})

// 创建订单（开房）
router.post('/back/openRoom', [back.openCheck, back.openRoom, back.getOrderId, back.modifyRoomStateAndOrderId], (req, res)=>{
    res.send({
        code:res.code,
        message:res.message,
        data:res.data,
    })
})

// 获取全部待核销的订单（state=0）
router.get('/back/getAllStateZeroOrderList', back.getAllStateZeroOrderList, (req, res)=>{
    res.send({
        code:res.code,
        message:res.message,
        data:res.data,
    })
})

// 根据orderId获取订单信息
router.post('/back/getOrderInfo', back.getOrderInfo, (req, res)=>{
    res.send({
        code:res.code,
        message:res.message,
        data:res.data,
    })
})

// 退房（1、改roomlist表。2、改orders表。）
router.put('/back/closeRoom', [back.closeRoomForRoomList, back.closeRoomForOrders], (req, res)=>{
    res.send({
        code:res.code,
        message:res.message,
        data:res.data,
    })
})

// 换房（1、修改order；2、新房添加orderId；3、旧房清除orderId）
router.put('/back/changeRoom', [back.changeRoomForOrder, back.changeRoomForNewRoom, back.changeRoomForOldRoom], (req, res)=>{
    res.send({
        code:res.code,
        message:res.message,
        data:res.data,
    })
})

// 查询用户订单
router.post('/back/getOrderListByUserId', back.getOrderListByUserId, (req, res)=>{
    res.send({
        code:res.code,
        message:res.message,
        data:res.data,
    })
})

// 查询线上待分配订单
router.get('/back/getOnlineOrderList', back.getOnlineOrderList, (req, res)=>{
    res.send({
        code:res.code,
        message:res.message,
        data:res.data,
    })
})

module.exports = router;